import request from '@/utils/request'

// 查询天猫账户列表
export function listAccount(query) {
  return request({
    url: '/jihuo/account/list',
    method: 'get',
    params: query
  })
}

// 查询天猫账户详细
export function getAccount(jhId) {
  return request({
    url: '/jihuo/account/' + jhId,
    method: 'get'
  })
}

// 新增天猫账户
export function addAccount(data) {
  return request({
    url: '/jihuo/account',
    method: 'post',
    data: data
  })
}

// 修改天猫账户
export function updateAccount(data) {
  return request({
    url: '/jihuo/account',
    method: 'put',
    data: data
  })
}

// 修改天猫账户
export function updateJhTmAccountConfig(data) {
  return request({
    url: '/jihuo/account/updateJhTmAccountConfig',
    method: 'put',
    data: data
  })
}

// 删除天猫账户
export function delAccount(jhId) {
  return request({
    url: '/jihuo/account/' + jhId,
    method: 'delete'
  })
}

// 流量转移
export function transferTraffic(originalId, jhId) {
  return request({
    url: '/jihuo/account/transferTraffic',
    method: 'post',
    data: {
      jhId: jhId,
      originalId: originalId
    }
  })
}

// 流量转移
export function checkAuthorization(jhId) {
  return request({
    url: '/jihuo/account/checkAuthorization/' + jhId,
    method: 'post',
  })
}
